package com.laotou99.test2;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class Test2 {

	public static void main(String[] args) {

		ExecutorService es1 = Executors.newCachedThreadPool(); 
		es1.execute(new Runnable() { 
			@Override
			public void run() {
				System.out.println("abc2");
			}
		});		
		es1.execute(new Runnable() { 
			@Override
			public void run() {
				System.out.println("abc1");
			}
		});
		
		ExecutorService es2 = Executors.newFixedThreadPool(10);
		es2.execute(new Runnable() {			
			@Override
			public void run() {
				System.out.println("abc3");
			}
		});
		es2.execute(new Runnable() {			
			@Override
			public void run() {
				System.out.println("abc4");
			}
		});
		
		ScheduledExecutorService ses1 = Executors.newScheduledThreadPool(10);
		ses1.execute(new Runnable() {
			@Override
			public void run() {
				System.out.println("abc5");
			}
		});

		ExecutorService es3 = Executors.newSingleThreadExecutor();
		es3.execute(new Runnable() {
			@Override
			public void run() {
				System.out.println("abc6");
			}
		});
		
		
		System.out.println(es1.isTerminated());
		System.out.println(es2.isTerminated());
		System.out.println(es3.isTerminated());
		System.out.println(ses1.isTerminated());
	}

}
